home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SGI Developer Toolbox 6.1
/
SGI Developer Toolbox 6.1 - Disc 4.iso
/
src
/
haeberli
/
objtools
/
tltotext.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-08-01
|
2KB
|
84 lines
/*
* Copyright 1991, 1992, 1993, 1994, Silicon Graphics, Inc.
* All Rights Reserved.
*
* This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
* the contents of this file may not be disclosed to third parties, copied or
* duplicated in any form, in whole or in part, without the prior written
* permission of Silicon Graphics, Inc.
*
* RESTRICTED RIGHTS LEGEND:
* Use, duplication or disclosure by the Government is subject to restrictions
* as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
* and Computer Software clause at DFARS 252.227-7013, and/or in similar or
* successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
* rights reserved under the Copyright Laws of the United States.
*/
/*
* tltotext -
* Print a triangle list in text format.
*
* Paul Haeberli - 1990
*/
#include "math.h"
#include "stdio.h"
#include "vect.h"
#include "trilist.h"
#include "lum.h"
main(argc,argv)
int argc;
char **argv;
{
FILE *outf;
int blk;
if(argc<2) {
fprintf(stderr, "usage: tltotext input.tl\n");
exit(1);
}
trilisttotext(argv[1]);
}
float greyval(c)
long c;
{
float r, g, b;
r = ((c>>0)&0xff)/255.0;
g = ((c>>8)&0xff)/255.0;
b = ((c>>16)&0xff)/255.0;
return LUM(r,g,b);
}
cpacktov(c,v)
long c;
vect *v;
{
v->x = ((c>>0)&0xff)/255.0;
v->y = ((c>>8)&0xff)/255.0;
v->z = ((c>>16)&0xff)/255.0;
}
trilisttotext(name)
char *name;
{
int i, ntri;
trilisttri tri;
vect p0, p1, p2;
vect c0, c1, c2;
ntri = tlopen(name);
fprintf(stdout, "ntri: %d\n",ntri);
for(i=0; i<ntri; i++) {
tlread(&tri);
fprintf(stdout, "triangle %d:\n",i);
fprintf(stdout, "\tv0: %f %f %f 0x%08x:\n",tri.x0,tri.y0,tri.z0,tri.c0);
fprintf(stdout, "\tv1: %f %f %f 0x%08x:\n",tri.x1,tri.y1,tri.z1,tri.c1);
fprintf(stdout, "\tv2: %f %f %f 0x%08x:\n",tri.x2,tri.y2,tri.z2,tri.c2);
}
tlclose();
}